Product : ISaGRAF V3
Date : 29-March-1999
File : Integral.htm
Subject : Integral algorithm
Keywords: Integral - standard function block - C function block
____________________________________________________________________
Integral standard function block algorithm:
Arguments:
RUN BOO mode: TRUE=integrate / FALSE=hold
R1 BOO overriding reset
XIN REAL input: any real analog value
X0 REAL initial value
CYCLE TMR sampling period
Q BOO Not R1
XOUT REAL integrated output
Description:
Integration of a real value.
Algorithm
/* delay is the current cycle time -
If the "CYCLE" parameter value is less than the cycle timing of the ISaGRAF application,
the sampling period is the cycle timing of the application. */
IF (delay > CYCLE) THEN
date = LAST_DATE;
Q = NOT R1;
IF (R1) THEN XOUT = X0;
ELSE THEN
IF (RUN) THEN
XOUT = XOUT + XIN * (TIME_TO_REAL)delay;
END_IF;
END_IF;
END_IF;
Caution: As you can see RUN input change is only taken into account when CYCLE has ellapsed.
____________________________________________________________________
Copyright © 1996-2009 ICS Triplex ISaGRAF Inc. All rights reserved.